<template>
    <div id="" class="tem">
      <div class="df">
        <h3>{{username}} 欢迎使用车辆管理系统！</h3>
        <div class="router">
          <router-link to="/use_control/add_vehicle">添加车辆</router-link>
          <router-link to="/use_control/userinfo">完善个人信息得优惠</router-link>
        </div>
      </div>

    </div>
</template>

<script>
  //数据异常提示
  import { Toast } from 'mint-ui';
    export default {
        name: "homepage",
      data(){
          return{
            username:""
          }
      },
      created(){
          this.getname();
      },
      methods:{
          //请求用户名
        getname:function () {
          var url="../../../static/home.json";
          this.$http.get(url).then(function (response) {
            var body = response.body;
            if(body.status != 0){
              Toast({  //mint-ui 提示
                message: '数据异常',
                position: 'bottom',
                duration: 5000
              });
              return;
            }
            this.username = body.username;
          })
        }
      }
    }
</script>

<style scoped>
  .tem{width: 100%}
  .df{width: 70%;margin: 0 auto;text-align: left}
    h3{margin: 100px auto 0;}
  .router{
    margin: 20px auto;
    font-size: 16px;
    text-align: left;
  }

</style>
